package controller

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

type LinkController struct {
	*BaseController
}

func (l *LinkController) Index(c *gin.Context) {
	articleLatest := articleModel.GetArticleLatest()
	articleTotal := articleModel.GetArticleTotal()
	categoryTotal := categoryModel.GetCategoryTotal()
	tags := tagModel.GetTagAll(10)

	data := gin.H{
		"articleLatest": articleLatest,
		"articleTotal":  articleTotal,
		"categoryTotal": categoryTotal,
		"tags":          tags,
		"title":         "友链_全栈工匠",
		"keywords":      "全栈开发，系统架构，后端博客，前端博客，后端框架，前端框架，PHP，Java，C#，Golang，Python，Vue，Html，Javascript，CSS",
		"description":   "一个专注于分享全栈以及系统架构技术和趋势的博客",
		"site":          "zhongxc.cc",
		"pvCount":       l.GetPv(),
		"likeCount":     articleModel.GetLikeCount(),
	}

	// 渲染模板
	c.HTML(http.StatusOK, "links.tmpl", data)
}
